﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using JKF.DataModule.SqlServerDAL;
using JKF.Entities.Model;

namespace JKF.BusinessLayer.BLL
{
    /// <summary>
    /// 业务逻辑类bllSMS_SEND_LOG 的摘要说明。
    /// </summary>
    public partial class bllSMS_SEND_LOG
    {
        /// <summary>
        /// 获得一个批次待发送短信
        /// </summary>
        /// <returns></returns>
        public static IList<SMS_SEND_LOGinfo> GetSms2Send()
        {
            return dalSMS_SEND_LOG.GetSms2Send();
        }

        /// <summary>
        /// 短信发送完成处理相关状态
        /// </summary>
        /// <param name="smsSendLogId"></param>
        /// <param name="status"></param>
        /// <param name="consumeNum"></param>
        /// <param name="reasonFailed"></param>
        public static bool SendSmsCallBack(Guid smsSendLogId, string status, int consumeNum, string reasonFailed)
        {
            return dalSMS_SEND_LOG.SendSmsCallBack(smsSendLogId, status, consumeNum, reasonFailed);
        }

        /// <summary>
        /// 添加短信
        /// </summary>
        /// <returns></returns>
        public static bool SmsSendLogAdd(SMS_SEND_LOGinfo loginfo)
        {
            return dalSMS_SEND_LOG.SmsSendLogAdd(loginfo);
        }

        /// <summary>
        /// 返回是否有短信需要发送
        /// </summary>
        /// <returns></returns>
        public static bool HasSms2Send()
        {
            return dalSMS_SEND_LOG.HasSms2Send();
        }

        /// <summary>
        /// 已发送短信列表
        /// </summary>
        /// <param name="sendTimeStart"></param>
        /// <param name="sendTimeEnd"></param>
        /// <param name="shopCode"></param>
        /// <param name="taskType"></param>
        /// <param name="status"></param>
        /// <param name="field"></param>
        /// <param name="fieldValue"></param>
        /// <param name="currentUser"></param>
        /// <param name="pageCurrent"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageCount"></param>
        /// <param name="rowCount"></param>
        /// <returns></returns>
        public static DataTable GetSmsSendedPaging(DateTime? sendTimeStart, DateTime? sendTimeEnd, string shopCode,
                                                   string taskType,
                                                   string status, string field, string fieldValue, string currentUser,
                                                   int pageCurrent, int pageSize, ref int pageCount, ref int rowCount)
        {
            return dalSMS_SEND_LOG.GetSmsSendedPaging(sendTimeStart, sendTimeEnd, shopCode, taskType, status, field,
                                                      fieldValue, currentUser,
                                                      pageCurrent, pageSize, ref pageCount, ref rowCount);
        }

        /// <summary>
        /// 获得莫客户的短信记录
        /// </summary>
        /// <param name="customerKey"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public static DataTable GetSmsByCustomer(string customerKey, string currentUser)
        {
            return dalSMS_SEND_LOG.GetSmsByCustomer(customerKey, currentUser);
        }
    }
}
